package com.zhouhailin;

/**
 * Lambda 和 this 关键字
 * Lambda表达式主体内使用的this关键字和其所在的类实例相同
 *
 * @Author zhouhailin
 * @date 2023/1/17 16:23
 */
public class LambdaDemo {
    public static void main(String[] args) {
        new LambdaDemo().work();
    }

    public void work() {
        System.out.printf("this = %s%n", this);

        Runnable r = new Runnable() {
            @Override
            public void run() {
                System.out.printf("this = %s%n", this);
            }
        };
        new Thread(r).start();
        new Thread(() -> System.out.printf("this = %s%n", this)).start();
    }
}
